<template>
  <div>
      <common-head title="支付"></common-head>
        <div class="wrap">
            <van-contact-card
                :type="type"
                :name="currentOrder.contact.name"
                :tel="currentOrder.contact.tel"
                @click="onEdit"
                />
            <div class="items">
                <van-card
                    v-for="item in currentOrder.items"
                    :key="item.id"
                    :num="item.id"
                    :price="item.minPrice"
                    :title="item.name"
                    :thumb="item.pic"
                    />
            </div>
        </div>
      <van-submit-bar :price="currentOrder.total*100" button-text="提交订单" @submit="onSubmit" />
  </div>
</template>

<script>
import CommonHead from '@components/CommonHead'
import { mapState } from 'vuex'
export default {
    methods: {
        onEdit () {
        },
        onSubmit () {
            alert('1')
        }
    },
    computed: {
        ...mapState({
            currentOrder: state => state.order.currentOrder
        }),
        type () {
            if (this.currentOrder.contact.name) {
                return 'edit'
            } else {
                return 'add'
            }
        }
    },
    components: {
        CommonHead
    }
}
</script>

<style lang="scss" scoped>
.wrap{
    margin-top: 46px;
    margin-bottom: 50px;
}
</style>